def check(x):
   stc = []
   for h in x:
      
      if h == "[" or h == "{" or h == "(" or h == "<":
         stc.append(h)
      else:
         if len(stc) == 0:
            return False
         else:
            if stc[-1] == '[' and h ==']' or stc[-1] == '{' and h =='}' or stc[-1] == '(' and h == ')' or stc[-1] == '<' and h == '>':
              stc.pop()
   if len(stc) == 0:
      return True
   
   return False

print(check(input("введите скобочную последовательность:")))
